package com.example.app.ui.health;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.example.app.R;
import com.example.app.Entity.User;
import java.util.List;
public class HealthAdapter extends BaseAdapter {
    private Context context;
    private List<User> userList;
    public HealthAdapter(Context context, List<User> userList) {
        this.context = context;
        this.userList = userList;
    }
    @Override
    public int getCount() {
        return userList.size();
    }
    @Override
    public Object getItem(int position) {
        return userList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = convertView;
        ViewHolder holder;

        if (view == null) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = inflater.inflate(R.layout.health, null);
            holder = new ViewHolder();
            holder.nameTextView = view.findViewById(R.id.healthtv);
//            holder.ageTextView = view.findViewById(R.id.ageTextView);
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }

        User user = userList.get(position);
//        holder.nameTextView.setText(user.getUserName());
//        holder.ageTextView.setText(user.getPassword());

        return view;
    }

    static class ViewHolder {
        TextView nameTextView;
    }
}